import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import alias from "@rollup/plugin-alias";
import path from 'path'
const Time:number = new Date().getTime();
// https://vitejs.dev/config/
// @ts-ignore
export default defineConfig({
  // base:'/inewsSales/',
  build: {
    // 输出文件目录   文件夹名
    outDir: 'inewsSales',
    rollupOptions: {
      output: {
        // 入口文件名
        entryFileNames: `js/[name].${Time}.js`,
        // 块文件名
        chunkFileNames: `js/[name].${Time}.js`,
      },
    },
  },
  plugins: [alias(),vue(),
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData:'@import "./src/assets/style/main.scss";'
      }
    }
  },
  server: {
    host: "0.0.0.0",
    port: 2020,
  }
})